package com.creawor.hz_market.t_yidongdate;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Date;
import java.util.Properties;

public class ReportConfig {
	
	public ReportConfig(){
		init();
	}
	
	private void init(){
		try{
			Properties pro=new Properties();
			InputStream in=this.getClass().getResourceAsStream("set.properties");
			pro.load(in);
			String zylYLinestr=(String)pro.get("zylYLine");
			if(null!=zylYLinestr){
				zylYLine=Integer.parseInt(zylYLinestr);
			}
			String d189Linestr=(String)pro.get("d189Line");
			if(null!=d189Linestr){
				zylYLine=Integer.parseInt(d189Linestr);
			}
			String daysmsLinestr=(String)pro.get("daysmsLine");
			if(null!=daysmsLinestr){
				daysmsLine=Float.parseFloat(daysmsLinestr);
			}
			this.mobiles=(String)pro.get("mobiles");
		}catch(Exception e){
			
		}
	}

	private int zylYLine=70;
	
	private int d189Line=60;

	private float daysmsLine=(float)5.7;
	
	private String mobiles;
	
	public int getZylYLine() {
		return zylYLine;
	}

	public void setZylYLine(int zylYLine) {
		this.zylYLine = zylYLine;
	}
	
	
	private static ReportConfig _inst=new ReportConfig();
	
	public static ReportConfig getInst(){
		return _inst;
	}
	
	

	public int getD189Line() {
		return d189Line;
	}

	public void setD189Line(int line) {
		d189Line = line;
	}

	public float getDaysmsLine() {
		return daysmsLine;
	}

	public void setDaysmsLine(float daysmsLine) {
		this.daysmsLine = daysmsLine;
	}
	
	public void save(){
		try {
			Properties pro=new Properties();
			File file=new File(this.getClass().getResource("set.properties").getFile());
			InputStream in=this.getClass().getResourceAsStream("set.properties");
			pro.load(in);
			pro.setProperty("d189Line", String.valueOf(d189Line));
			pro.setProperty("zylYLine", String.valueOf(zylYLine));
			pro.setProperty("daysmsLine", String.valueOf(daysmsLine));
			pro.setProperty("mobiles", this.mobiles);
			pro.save(new FileOutputStream(file), new Date().toLocaleString());
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public String getMobiles() {
		return mobiles;
	}

	public void setMobiles(String mobiles) {
		this.mobiles = mobiles;
	}
}
